package 代码记录.指定公司代码练习记录.西安.分值200分;

import java.util.Scanner;

/**
 * @author zx
 * @create 2023-07-09 18:16
 * 自己做的
 */
public class 数字的排列or数字反转打印 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 1;
        for(int i = 1;i <= n;i++){
            String line = "";
            if(i % 2 == 1){//奇数
                for(int j = 0;j < i;j++){
                    String temp = Integer.toString(count);
                    count++;
                    while(temp.length() < 4){
                        temp = temp + "*";
                    }
                    line = line + temp + "    ";
                }
            }else if(i % 2 == 0){
                int k = count + i - 1;
                for(int j = 0;j < i;j++){
                    String temp = Integer.toString(k);
                    k--;
                    while(temp.length() < 4){
                        temp = temp + "*";
                    }
                    line = line + temp + "    ";
                }
            }
            if(n == 1){
                System.out.println(line);
            }else{
                if(i == n - 1){
                    line = "    " + line;
                }
                System.out.println(line);
            }
        }
    }
}
